home *** CD-ROM | disk | FTP | other *** search
/ .net 1997 May / net 32 / NET32PC.iso / mac / NET32PPC / NET32PPC.dxr / 00369_help text.txt < prev    next >
Encoding:
Text File  |  1997-04-11  |  4.5 KB  |  58 lines

  1. 1. Run the "hyperlink" movie. It appears to work on director 5.0, Mac and PC. Coloring of hyperlinks doesn't work in director 4.0, which is totally not my fault.
  2. 2. Copy the source text into the blue box at the top.
  3.  
  4. 3. Mark up the source text with hml-like anchor tags. The html anchor tag looks like this <a href=[page address]>link</a>. Use the same tag, except instead of using the "href" attribute, simply add a line of director code.
  5.  
  6.     <a [director command...]>link</a>
  7.  
  8. Everything after the "a" will be exectuted using the Lingo "do" command, so there can't be any quotation marks in there EXCEPT for things like "go to "this marker"". In this case, note that the " gets translated into the QUOTE symbol in the anchor list. Also, you really want to keep your command to one line of code, and no hard returns either, or you'll get an error. For more complex things, put them in a seperate handler and call the handler from the anchor tag.
  9.  
  10. The tags shown here are examples.
  11.  
  12.     do <a nothing>nothing</a>. 
  13.     <a put the mouseH>show me the horizontal position of the
  14.          mouse please</a>
  15.     <a go to "this marker">"go to "this marker""</a>
  16.     <a beep 2>beep at the user</a>
  17.     <a doThatThing (this, that)>call a handler</a>
  18.     <a Fileio(mDescribe)>more complex things</a>, 
  19.  
  20. You can have as many tags as you want, although for large (>50?) numbers of links you may suffer a speed hit (haven't tested this, but it could happen). In this case see below for how to break the text into more than one castmember. 
  21.  
  22. 4. Press the "parse" button. This will read in the source text, and spit out a castmember caller "display text" in the yellow box below. The display text will have associated with it a castmember called "anchor list", which contains the hyperlinking information for that text. At run time, you need only three castmembers: "display text", "anchor list" and "hyperlink code" to make the text act like it is hyperlinked.
  23. Note that "parse" will not change your original "source text" at all.
  24. Note2: Unfortunately, "parse" does not keep text style changes in "source text" at the moment. This could be added fairly easily now that director supports character-by-character text style assignment.
  25.  
  26. 5.  Test your mark-up by clicking in the "display text" (with the movie still running). When you hit a character which has been correctly marked up, the code associated with the text will be executed. You can assure yourself of this fact by checking the message window; every time you click on hyperlinked text, it will print "executing " and the lingocommand.
  27.  
  28.     "executing: doThatThing (this, that)"
  29.  
  30. You can continue to edit your source text and re-parse it as much as you'd like. Parse will replace the text in display text each time.
  31.  
  32. 6. When you have the text marked up like you want it, parse one last time, and stop the movie.
  33.  
  34. 7. You can now copy the cast members "display text", "anchor list"  and "hyperlink code" into the cast of your own movie. These are the only members you need to make your text work at run time. You do not need the "parse" code unless you want to give your users the ability to make their own links. Alternatively you can save this movie as a different name and delete all other castmembers.
  35.  
  36. 8. That's it! Place the "display text" castmember on the stage wherever you want it. When you run the movie, that castmember should be click-sensetive. Enjoy safe, soluble code!
  37.  
  38. >8. If you want to have more than one hyperlinked castmember in your movie you will need to rename "display text" and "anchor list" so that "hyperlink code" knows which anchor list to associate with which display text. When you do this, simultaneously change the script of display text" to say
  39.           hyperlink (the mousechar, "xxx")
  40. where xxx is the new name of the "anchor list" cast member. For example you could...
  41.  
  42.    a) rename "display text" to "introduction text"
  43.    b) change the cast script of "introduction text" to
  44.           on mousedown
  45.             hyperlink(the mousechar, "intro alist")
  46.           end
  47.    c) rename "anchor list" to "intro alist"
  48.  
  49. No matter how many hyperlinked text members you have, you only need one copy of the "hyperlink code" castmember in your movie.
  50.  
  51.  
  52. Final note:
  53. When the "underline links" radio button is checked, parse will modify the text style of the appropriate text in "display text" to make it look like like a link. Unfortunately this process is very SLOW (go ahead, ask me why!), so you want to turn it off until the final parse. You can set "linkStyle" and "linkColor" in the "underlineLinks" script.
  54.  
  55. comments, credits and cliches welcome,
  56.  
  57. Eric LoPresti
  58. eric_lopresti@iris.com